package cn.regexp.demo.action;

import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;

/**
 * @author Regexpei
 * @date 2024/6/10 20:02
 * @description
 */
public class CommentAction extends AnAction {

    // 按钮的具体执行逻辑
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
        Messages.showInfoMessage("Click button", "Click");
    }

    // 根据某些条件更新按钮状态
    @Override
    public void update(@NotNull AnActionEvent e) {
        e.getPresentation().setIcon(AllIcons.Actions.RealIntentionBulb);
    }

    @Override
    public @NotNull ActionUpdateThread getActionUpdateThread() {
        return super.getActionUpdateThread();
    }
}
